Skip to main content

Action Items

July 2023

  • Sudhir had made some fixes on the BSM2_devel file in the BSM2 - copy 2023-07-27 project
  • Brian has added a fix in the BSM2_devel in the original project BSM2

December 2022

List of problems

All these issues had been fixed by fixing the bioreactor submodel block inside the Activated Sludge submodel block.

  1. Primary Clarifier variable outputs that needed to be fixed.
    1. So
    2. Sno (values are less than zero)
    3. The potential source of problem is likely due to error in So control in Activated Sludge block
  2. Activated Sludge variable outputs that needed to be fixed.
    1. Ss (The influent value should be around 4 to 30, however, the output from collimator is in 100 or greater)
    2. So (The value should be around 1-2, however, the output from collimator is in 100 or greater)
    3. Sno (values are less than zero)
    4. Snh (The influent value from collimator is almost double the Matlab value and the effluent should be closer to zero)
    5. Snd (The value should be around 0 to 3. The output from collimator has the value up to 50)
    6. Salk
    7. Xs (The output should be in 10 magnitude. However, we got value around 1000 in collimator)
    8. Xbh (The value should be fairly steady over time. The output from collimator shows the value is decreasing over time)
    9. Xnd (The value should be 2-5 (no more than 10). The output from collimator shows the value is increasing over time. At day 2, the value is about 50)
    10. The potential source of problem are
      1. Activated Sludge block
  3. Settler variable outputs that needed to be fixed.
    1. Ss, So, Sno, Snh, Snd, Salk
    2. Xs, Xbh, Xnd
    3. The potential source of problem are
      1. Activated Sludge block
  4. Effluent variable outputs that needed to be fixed.
    1. Ss, So, Sno, Snh, Snd, Salk
    2. Xs, Xbh, Xnd
    3. The potential source of problem are
      1. Activated Sludge block

List of submodels that needed to be fixed

  1. Bioreactor in Activated Sludge block.
    1. There is a problem with the current bioreactor block. I have compared the output to the Matlab output and found the following issues:
      1. Snh keeps increasing over time. It goes up to 1e38 on day 2. The value should be between 2 and 13.
      2. Snd goes to zero over time because the value is negative. The value should be around 0.5 to 1.5. The value should be between 0.5 and 1.5.
      3. Salk keeps increasing over time. It goes up to 1e37 on day 2. The value should be between 5 and 6
      4. The ODE is implemented the same way for each variable. The problem is likely to happen when calculating the reaction value that is added to ODE equation.
        1. I replaced the Snh, Snd, and Salk ODE block with their average values to test whether there is error with reac block. The reac block does not give any error.
      5. There is no problem with other soluble and particulate variables.
    2. The main issue is Snh is increasing exponentially. If we are able to find the reason why Snh is increasing exponentially, we can fix Salk because Salk is dependent on Snh value. However, this does not fix Snd value.
  2. So Control block in Activated Sludge block.
    1. The issue regarding So and Sno is likely due to the So control block and not the bioreactor block.
  3. The source of error of particulates for other submodels has not been identified.

Nov 29 and Nov 30

  1. create a bioreactor submodel

  2. Compare the result between bioreactor 1 from matlab to collimator

    1. Snh keeps increasing over time. It goes up to 1e38 at day 2
    2. Snd goes to zero over time (The value should be around 0.5 to 1.5 )
    3. Salk keeps increasing over time. It goes up to 1e37 at day2
    4. There is no problem with particulate variables.
  3. When substituting the bioreactor block the new bioreactor submodel block, the simulation can run up to 0.36 before aborting the simulation (simulation stopped: timed out after 4000000 ms)

Nov 25

  1. Debug why Soluble output is negative. The problem is likely to be due to Activated Sludge block
    1. Start with So4 control in Activated Sludge
    2. Redesign the bioreactor block. Currently bioreactor4 outputs So = 300. The So should be around 2.
      1. The model was compiled successfully when replacing bioreactor1 with the new design.
      2. There is an algebraic loop when replacing bioreactor 3-5 with the new design due to we are feeding KLa back to biorector 3-5.
      3. The old design did not have produce this problem because I did not implement a block/code to check if KLa is negative before assigning So value.
      4. In Matlab, they have a concept of direct feedthrough to handle this problem
      5. The algebraic loop problem is solved when adding unit delay block in collimator.
      6. The outputs are no longer negative. However, the outputs are still incorrect
      7. There are still problem with Snh, Snd, and Salk

November 20

  1. Create md files using pandoc for Collimator. (using pandoc)
    pandoc -s "BSM2 in collimator.docx" -t markdown --extract-media . -o BSM2_in_collimator.md
    1. Format the created md files.
  2. Report issues to Brian
  3. Create a fast.AI test script test case in Collimator and have a walk through with Brain on how to install custom modules in Collimator.
    1. If above works, then test time-series prediction script in python.
  4. Test importing python file from collimator python block.

    Does not work! python importing does not work

  5. Rename the collimator modules and variables and document the naming convention.
  6. Get all parameters to single csv or python file. (python file approach does not work)
  7. Access parameter values defined in the model parameter or submodel parameter in the python script blocks
  8. Ability to change parameter values defined in the submodel parameter from the notebook

October 31

Settler

  1. State: Soluble variables

  2. State: TSS

    1. Layer 1 - 4
    2. Feed layer (5)
    3. Layer 6-10
  3. State: Particulate variables (exclude TSS)

    1. require the state of TSS at layer 1 (0) and layer 10 (9) to calculate for gamma and gamma_eff
  4. Output:

    1. RAS:
      1. Soluble and TSS: concentration at the 10th layer (bottom)
      2. Particulate: input*gamma
      3. flows = Qr (user input)
      4. Temperature (tempmodel=1)
    2. Overflow
      1. Soluble and TSS: concentration at the 1st layer (top)
      2. Paticulate: input*gamma_eff
      3. flow = Qe = u[Q] - Qr - Qw
      4. Temperature
    3. Waste
      1. Soluble and TSS: concentration at the 10th layer (bottom)
      2. Particulate: input*gamma
      3. flow = Qw (from Qw_time_controller block)
      4. Temperature
  5. Results

    1. This issue has been fixed. The output from Soluble_Sno <= 0. We need to check the block

Thickener

  1. complete
    1. Input:
      1. WAS flow from settler block
    2. State:
      1. function script in Matlab: thickener_bsm2
      2. function parameters: THICKENPAR
    3. Output:
      1. Overflow
      2. Underflow

Qthickener2A2_split

  1. complete
    1. will do in python script block
    2. Should be simple to implement

Anaerobic Digester

  1. Will be complicated.

  2. ODE maybe similar to Activated Sludge

  3. There are three main blocks

  4. ASM2ADM

    1. Step 1
    2. Step 2
    3. Step 3
    4. Step 4
    5. Step 5
    6. Step 6
    7. Charge
    8. Output
  5. ADM

    1. ADM1
    2. Sh2 solver
    3. pH solver
  6. ADM2ASM

    1. all five step

Dewatering

  1. Will be similar to thickener block

StorageTank

  1. Combination of flow by pass block and flow combiner block
  2. Some ODE

Qstorage2AS_split

  1. Will be done in python script block

October 17

  • At 10:49:20AM 2022-10-17 - BSM2_model_old_flowcombiner works fine when Qr = 0.
  • However, there is error when Qr flow = 20,068 is added to Activatedsludge input port because there is a calculation that tried to divide by zero (happen in rec python block inside activatedsludge)
    • I think the problem is when I set Q_r to be 20,648 as a placeholder for my return flow from the settler, I still have other variables, such as the concentration of soluble materials and particulate materials of the return flow, to be zero. As a result, the concentration of the flow got diluted over time and eventually, the concentration of particulate material was equal to zero.
  • If you read integer values from CSV using a python script block, sometime you will have to use float(values) to convert it to float to do the operation to not getting an error saying that the value is not an int or float.

October 07

  • Flow coming out of primary clarifier to Activated Sludge block are the same. Flow from PC block to AS block

  • Flow from hyddely block to bioreactor 1 located inside Activated Sludge block are different by ~20,000 m^3/day. This might be due to RAS flow from Settling tank is set to zero at the moment. Need to check the flow RAS in the matlab. Flow from hyddely block to bioreactor1 inside AS block

  • Will need to change the name of block and variables so that it follows the python standard.

  • Naming standard

  • Write the python code in vs code and paste it to the python script block

  • Need to ask Brian if we can tell how many input port are feeding to the python block. So that we can code that are generic to the different number of input port.